<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <link rel="stylesheet" href="../css/reset.css">
    <style>
        .container {
            width: 1226px;
            margin: 50px auto;
            display: flex;
            min-height: 500px;
            /* background-color: #f0f0f0; */
        }

        .preview-wrap {
            width: 400px;
            /* background-color: #ccc; */
            position: relative;
        }

        .preview {
            width: 400px;
            height: 400px;
            background-color: orange;
            position: relative;
        }

        .preview .shadow {
            width: 200px;
            height: 200px;
            background-color: rgba(0, 0, 0, 0.5);
            position: absolute;
            left: 0;
            top: 0;
        }

        .preview-scale {
            width: 400px;
            height: 400px;
            position: absolute;
            left: -webkit-calc(100% + 10px);
            top: 0;
            background-color: #6ff;
        }

        .itemInfo-wrap {
            flex: 1;
            margin-left: 10px;
            /* background-color: pink; */
        }
    </style>
</head>

<body>
    <!-- .magnifier -->
    <div class="container">
        <div class="preview-wrap">
            <div class="preview">
                <div class="shadow"></div>
            </div>
            <div class="preview-scale"></div>
        </div>
        <div class="itemInfo-wrap"></div>
    </div>
</body>
<script>
    var previewWrap = document.getElementsByClassName("preview-wrap")[0];
    var preview = document.getElementsByClassName("preview")[0];
    var shadow = document.getElementsByClassName("shadow")[0];

    preview.onmousemove = function (e) {
        var e = e || window.event;

        var x = e.pageX - previewWrap.offsetLeft - shadow.clientWidth / 2;
        var y = e.pageY - previewWrap.offsetTop - shadow.clientHeight / 2;

        shadow.style.left = x + "px";
        shadow.style.top = y + "px";

    }





</script>

</html>